<h2>Список таблиц</h2>

<?php if($_SESSION['userType']!=0)
{
?>
	<script type="text/javascript" src="/js/admin/pricelist.js"></script>
	<script type="text/javascript" src="/js/admin/calendar.js"></script>
<?php
}
else
{
?>
	<script type="text/javascript" src="/js/user/pricelist.js"></script>
	<script type="text/javascript" src="/js/user/calendar.js"></script>
<?php
}
?>
<script type="text/javascript" src="/js/jquery/jQueryContextMenu/js/jquery.contextMenu.js"></script>
<link rel="stylesheet" type="text/css" href="/js/jquery/jQueryContextMenu/css/jquery.contextMenu.css" />
<script>
	var tables=[];
	 var rows='<?php echo $rows;?>';
</script>
<br>
<div id='service' service='<?php echo $service;?>'></div>
<?php if($_SESSION['userType']!=0)
{
?>
<div id='addTable' class='addTable' service="<?php echo $service;?>" style="background-color: #fc0;">Добавить новую таблицу</div>
<div id='deleteTables' class='deleteTables' service="<?php echo $service;?>" style="background-color: #fc0;">Удалить все таблицы</div>
<?php
}
?>
<div class='mWindowTest'></div>

<div id='Calendar'></div>
<div class='editPrice'></div>
<div >

<table border=0  padding=0 margin=0 width=100%>
<tr>
<?php

	$mm=date('m');
	$yy=date('Y');
	$monthA=array("Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь");
	$dayA=array("Вс","Пн","Вт","Ср","Чт","Пт","Сб");
	for($i=0;$i<12;$i++)
	{
		$sp="";
		$spe="";
		echo "<td align=center>\n";
		echo "<div id='goMonth' class='goMonth' month='$mm' year='$yy' >".$sp.$monthA[$mm-1].$spe."</div>\n";
		echo "</td>\n";
		if($mm==12)
		{
			$mm=1;
			$yy++;
		}
		else
		{
			$mm++;
		}
	}
?>
</tr>
</table>
<div class='mWindowTestClone'></div>
<div class='mWindowTestDelete'></div>
<div class='mWindowTestDeleteByMonth'></div>
<div class='mWindowTestDeleteTable'></div>
<div class='mWindowTestDeleteAllTables'></div>

<?php if($_SESSION['userType']==0)
{?>
<table border=0  padding=0 margin=0 width=100%>
	<tr >
		<td width="2%"> &nbsp;</td>
			<td><h2>Таблица надбавок</h2> В данной таблице приведены наценки.</td>
			<td width="2%"> &nbsp;</td>
		</tr>
		<tr >
			<td width="2%"> &nbsp;</td>
			<td>
				<div id="pagerUserPrice"></div>
				<table id="tableUserPrice"></table>
				<script>createUserTable($('#service').attr('service'),$(".goMonth:eq(0)").attr("year"),$(".goMonth:eq(0)").attr("month"));</script>
			</td>
			<td width="2%"> &nbsp;</td>
		</tr>
</table>
<?php }?>
<table width="100%" border="0" padding=0 margin=0 id="tableList">

<?php

	foreach($list as $key=>$item)
		{
			echo '	<tr >
						<td width="2%"> &nbsp;</td>
						<td><h2>'.$item['name'].'</h2> '.$item['desc'].'</td>
						<td width="2%"> &nbsp;</td>
					</tr>
					<tr >
						<td width="2%"> &nbsp;</td>
						<td>
							<div id="pager'.$key.'"></div>
							<table id="table'.$key.'"></table>
							<script>tables.push('.$key.'); createTable("'.$key.'",$(".goMonth:eq(0)").attr("year"),$(".goMonth:eq(0)").attr("month"));</script>
						</td>
						<td width="2%"> &nbsp;</td>
					</tr>
			';

		}
	?>
 </table>
</div>
<?php if($_SESSION['userType']!=0)
{?>
<ul id="myMenu" class="contextMenu">
	<li class="insert"><a href="#addprice" class="addDataTable" id="addDataTable">Внести данные</a></li>
    <li class="copy"><a href="#clone" class="cloneTable" id="cloneTable">Клонировать таблицу</a></li>
    <li class="delete"><a href="#deletebymonth" class="deleteTableDataByMonth" id="deleteTableDataByMonth">Удалить данные за месяц</a></li>
    <li class="delete"><a href="#delete" class="deleteTableData" id="deleteTableData">Удалить все данные</a></li>
    <li class="delete"><a href="#deletetable" class="deleteTable" id="deleteTable">Удалить таблицу</a></li>
</ul>
<?php }else{?>
<ul id="myMenu" class="contextMenu">
	<li class="insert"><a href="#addprice" class="addDataTable" id="addDataTable">Внести данные</a></li>
	<li class="delete"><a href="#deletebymonth" class="deleteTableDataByMonth" id="deleteTableDataByMonth">Удалить данные за месяц</a></li>
	<li class="delete"><a href="#delete" class="deleteTableData" id="deleteTableData">Удалить все данные</a></li>
</ul>
<?php }?>